var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/configComponent/grid/gridView.tsx
var gridView_exports = {};
__export(gridView_exports, {
  GridView: () => GridView
});
module.exports = __toCommonJS(gridView_exports);
var import_react = require("react");
var import_util = require("../../util");
var import_common = require("../common");
function GridViewComp({ outRef, ...props }) {
  const { formConf, columns, showRowNumber, dataSource, defaultValue, ...others } = props;
  (0, import_util.useExtendRef)(outRef, () => ({
    getConfig() {
      return formConf;
    }
  }));
  const memoProps = (0, import_react.useMemo)(() => {
    let indexCol = showRowNumber;
    let cols = (Array.isArray(formConf) ? formConf : (formConf == null ? void 0 : formConf.children) || []).filter((item) => {
      isNaN(item.width) && delete item.width;
      const render = (0, import_common.parseFunction)(item["render"]);
      render && (item["render"] = render);
      if (item.xtype !== "rownumberer") {
        return item;
      } else {
        indexCol = {
          title: item.label
        };
        item.width && (indexCol["with"] = item.width);
        return false;
      }
    });
    if (columns) {
      cols = import_util.iup.isFunction(columns) ? columns(cols) : [...columns, ...cols];
    }
    return { indexCol, cols };
  }, [formConf, showRowNumber, columns]);
  const Grid = (0, import_util.getRegisterComponentWithProps)("Grid")[0];
  return /* @__PURE__ */ React.createElement(
    Grid,
    {
      ...others,
      ref: outRef,
      columns: memoProps.cols,
      dataSource: dataSource || defaultValue,
      showRowNumber: memoProps.indexCol
    }
  );
}
var GridView = (0, import_util.compHoc)((0, import_common.LayConfWrap)(GridViewComp));
(0, import_util.registerComponent)({ GridView });
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  GridView
});
